<template>
  <el-container>
    <el-header style="padding:0px">
      <el-row :gutter="20" class="header-banner">
        <el-col :span="4"><div class="grid-content"></div></el-col>
        <el-col :span="20"><div class="grid-content" style="color: #818C9E">从这里开始.</div></el-col>
        <el-col :span="4"><div class="grid-content"></div></el-col>
        <el-col :span="20"><div class="grid-content" style="color: #4A90E2">扩展你的人脉圈.</div></el-col>
      </el-row>
    </el-header>
    <img class="line-image" src="../assets/fill.png"/>
    <div class="main-background">
      <el-main>

        <el-row :gutter="20" class="main-title">
          <el-col :span="2">
            <div class="big-dot"></div>
          </el-col>
          <el-col :span="20"><div class="grid-content">规则介绍</div></el-col>
        </el-row>

        <el-row :gutter="20" class="main-row">
          <el-col :span="2"><div class="grid-content"></div></el-col>
          <el-col :span="20"><div class="grid-content">每周五晚20:00点，我们将为参与者找到新的小伙伴，争取做到：</div></el-col>
        </el-row>

        <el-row :gutter="20" class="main-row">
          <el-col :span="2"><div class="grid-content"></div></el-col>
          <el-col :span="20"><div class="grid-content">性别合适</div></el-col>
        </el-row>
        <el-row :gutter="20" class="main-row">
          <el-col :span="2"><div class="grid-content"></div></el-col>
          <el-col :span="20"><div class="grid-content">年龄合适</div></el-col>
        </el-row>
        <el-row :gutter="20" class="main-row">
          <el-col :span="2"><div class="grid-content"></div></el-col>
          <el-col :span="20"><div class="grid-content">背景合适</div></el-col>
        </el-row>
        <el-row :gutter="20" class="main-row">
          <el-col :span="2"><div class="grid-content"></div></el-col>
          <el-col :span="20"><div class="grid-content">……</div></el-col>
        </el-row>
      </el-main>
      <el-footer>
        <button 
          @click="joinin" v-if="id" class="el-button one-button is-round" :disabled="btn_disabled" type="button">
          <span v-loading="loading"
          element-loading-background="rgba(0, 0, 0, 0.1)">点击入场</span>
        </button>
      </el-footer>
    </div>
  </el-container>
</template>

<script>
    export default {
      name: "JoinMatch",
      data() {
        return {
          id:0,
          btn_disabled:false,
          loading:false,
        };
      },
      created:function(){


        this.$axios.get('/manghe/api/party_next').then(res =>{
          this.id = res.result.id
          if(res.result.join_time){
            this.$router.push('/joincount')       
          }

        });

      },
      methods: {

        joinin:function(){

          this.btn_disabled = true
          this.loading = true

          this.$axios.get('/manghe/api/party_in?id=' + this.id).then(res =>{

            this.btn_disabled = false
            this.loading = false

              console.log(res)
              //this.join = true
              this.$router.push('/joincount')

          }).catch(()=>{

            this.btn_disabled = false
            this.loading = false

            this.$notify({
              title: '提示',
              message: '通信发生了错误!',
              type:'error',
              position: 'bottom-right',
              duration: 3000,
              offset:100
            });

          });

        },
        showloading(){
          const loading = this.$loading({
            lock: true,
            text: 'Loading',
            spinner: 'el-icon-loading',
            background: 'rgba(0, 0, 0, 0.7)'
          });
          
          setTimeout(() => {
            loading.close();
          }, 3000);
        }
      }
    }
</script>

<style scoped>
  .big-dot{
    width:6px;
    display: inline-block;
    height:22px;
    background-color:#FFF;
    border-radius: 4px;
    margin-bottom:-3px;
    margin-left:15px;
  }
  .line-image {
    width: auto;
    margin-left: -8px;
    margin-right: -8px;
    height: 30px;
    margin-top: 80px;
  }
  .main-background {
    width: auto;
    margin-top: -2px;
    margin-left: -8px;
    margin-right: -8px;
    background-color: #4A90E2;
    min-height: 450px;
  }
  .main-background :after{
    height: auto;
  }
  .grid-content {
    min-height: 36px;
  }
  .header-banner {
    font-size: 29px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    line-height: 41px;
    text-align: left;
    padding:30px 0px;
    background-color:#FFF;
  }
  .main-title {
    text-align: left;
    font-size: 21px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 29px;
  }
  .main-row {
    text-align: left;
    font-size: 18px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 25px;
  }
  .one-button {
    width: 171px;
    height: 57px;
    background: #FFFFFF;
    border-radius: 645px;
    font-size: 21px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #4A90E2;
  }
</style>
